Endpoint
Path Parameters
string
required
Unique identifier for the room. Each room has its own isolated sandbox instance named
sandbox-{roomID}.Request Body
string
required
The shell command to execute. Must be at least 1 character long.
Response
ExecResult
The execution result containing stdout and stderr streams.
string
The name of the sandbox instance that executed the command (format:
sandbox-{roomID}).Example Request
Example Response
Error Responses
400 Bad Request
Returned when request validation fails:404 Not Found
Returned when the room ID is missing or the endpoint path is incorrect.405 Method Not Allowed
Returned when using a method other than POST.500 Internal Server Error
Returned when sandbox execution fails:Use Cases
- Direct command execution for scripting and automation
- Testing and debugging sandbox environments
- File system operations in the isolated environment
- Running build commands or test suites
Implementation Reference
The handler uses Cloudflare’s sandbox API:Sandbox Lifecycle
Each room has a persistent sandbox instance that:- Is created on first use
- Maintains file system state between commands
- Is isolated from other rooms’ sandboxes
- Can be destroyed using the DELETE /api/rooms/ endpoint
Related Endpoints
- POST /api/rooms//message - Send messages to AI (which may execute commands)
- DELETE /api/rooms/ - Destroy the sandbox and clean up room state